<?php

namespace App\Http\Requests\Admin\Panx\Product;

use App\Http\Requests\ApiRequest;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

/**
 * @property int $product_mod_id
 * @property string $name
 * @property array values
 *
 */

class ProductSpecStoreRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'product_mod_id' => 'required|numeric',
            'name'             => ['required', 'string'],
            'values'           => 'required|array',
            'values.*'         => 'required|string',
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'product_mod_id.*' => '商品模型的id必须是数值',
//            'name.*'             => '规格名称必须是唯一字符串',
//            'values.*'           => '规格值必须是数组',
//            'values.*.*'         => '规格值必须是数组',
//        ];
//    }
}
